package nl.hu.modellingengine.ribbon.client.activity;

import nl.hu.modellingengine.client.ClientFactory;
import nl.hu.modellingengine.client.place.InitPlace;
import nl.hu.modellingengine.ribbon.client.RibbonFactory;
import nl.hu.modellingengine.ribbon.client.places.ElementPositionChangePlace;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

public class RibbonActivityMapper implements ActivityMapper {
	
	private ClientFactory clientFactory;
	private RibbonFactory ribbonFactory;
	
	public RibbonActivityMapper(ClientFactory clientFactory, RibbonFactory ribbonFactory){
		this.clientFactory = clientFactory;
		this.ribbonFactory = ribbonFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if(place instanceof InitPlace){
			return new RibbonInitActivity((InitPlace)place, clientFactory,ribbonFactory);
		}
		if(place instanceof ElementPositionChangePlace){
			return new RibbonElementPositionChangeActivity((ElementPositionChangePlace)place, clientFactory,ribbonFactory);
		}
		return null;
	}

}
